home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5467 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: rcp6.elan.af.mil!rscernix!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Unbuffered character input...
  5. Date: 8 Feb 96 20:36:55 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <danpop.823811815@rscernix>
  8. References: <Pine.SGI.3.91.960129190205.27936A-100000@tahiti.cs.unm.edu> <9602022043.AA13287@dxmint.cern.ch> <4f7hlf$87n@airdmhor.gen.nz> <9602061701.AA21789@dxmint.cern.ch> <4f8kat$ofv@solutions.solon.com> <823794347snz@genesis.demon.co.uk>
  9. NNTP-Posting-Host: ues5.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11.  
  12. In <823794347snz@genesis.demon.co.uk> Lawrence Kirby <fred@genesis.demon.co.uk> writes:
  13.  
  14. >In article <4f8kat$ofv@solutions.solon.com>
  15. >           seebs@solutions.solon.com "Peter Seebach" writes:
  16. >
  17. >>In article <9602061701.AA21789@dxmint.cern.ch>,
  18. >>Dan Pop  <danpop@mail.cern.ch> wrote:
  19. >>>But even on systems where it is not, it still saves processor time.
  20. >>>The cpu overhead of making a single OS call to get a complete line of input
  21. >>>is smaller (sometimes significantly smaller) than the overhead of making
  22. >>>N OS calls, one for each character of the line.  The stdio library tries
  23. >>>to do its best to minimize the number of (expensive) OS calls.
  24. >
  25. >The stdio library typically reads characters as soon as they are available
  26. >so it does very little in this respect except provide suitable buffering
  27. >when more than one character happens to be available on a read. This is
  28. >clearly significant for file I/O but whether terminal I/O makes user typed
  29. >characters immediately available or not is usually purely a function of the
  30. >OS. Setting line buffering on input streams on many/most stdio libraries
  31. >doesn't do anything special.
  32.  
  33. Because the line buffering is performed by the tty driver.  The tty driver
  34. won't (unless explicitly asked) make characters available as soon as they
  35. are typed and the stdio library doesn't attempt to get them as soon as
  36. they're typed.  It looks like line buffered terminal input to me, unless 
  37. I'm missing something.
  38.  
  39. Dan
  40. --
  41. Dan Pop
  42. CERN, CN Division
  43. Email: danpop@mail.cern.ch 
  44. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  45.